home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Blitz2 / BlitzFaq / FaqLists / Floodfx.txt < prev    next >
Encoding:
Text File  |  1996-08-31  |  2.5 KB  |  94 lines

  1. ; #Code Start
  2. ; ***************************************
  3. ; ***        Flood effect V1.0        ***
  4. ; ***   From the effects library by   ***
  5. ; ***           Alex Moon             ***
  6. ; ***************************************
  7.  
  8. ; This routine does the flood effect known from several demos,
  9. ; and looks quite good.
  10.  
  11. ; First of all, load a bitmap:)
  12.  
  13. f$="Source:dune/gfx/64/tiles.lbm"      ; Insert your own filename here
  14.  
  15. ILBMInfo f$                             ; Get bitmap info
  16. w=ILBMWidth:  h=ILBMHeight: d=ILBMDepth
  17.  
  18. BitMap 0,w,h,d                          ; Setup the correct bitmap
  19. BitMap 1,w,h,d                          ; Setup a matching bitmap
  20. LoadBitMap 0,f$,0                       ; load it
  21.  
  22. tpe.l=d: If(CheckAGA)  tpe+$13000       ; define coplist type
  23.                                         ; and use AGA palette mode, if
  24.                                         ; AGA chipset present
  25. InitCopList 0,44,256,tpe,0,2^d,0        ; Init the coplist
  26. VWait 50
  27. BLITZ
  28. ; do display stuff
  29. CreateDisplay 0
  30. DisplayBitMap 0,1
  31. DisplayPalette 0,0
  32.  
  33. ;Flood from bottom to top
  34.  
  35. Use BitMap 1
  36. ; loop from 0 to bitmap height -1 (for each line)
  37. For i=0 To h-1
  38.   ; draw the current line from bottom to i
  39.   For j=h-1 To i+1 Step -1
  40.     ; using blockscroll for speed
  41.     BlockScroll 0,i,w,1,0,j,0
  42.   Next
  43.   VWait;  equalize the speed.
  44. Next
  45.  
  46. ;UnFlood from bottom To top
  47.  
  48. Use BitMap 1
  49. ; loop from 0 to bitmap height -1 (for each line)
  50. For i=h-1 To 0 Step -1
  51.   ; draw the current line from bottom to i
  52.   For j=h-1 To i+1 Step -1
  53.     ; using blockscroll for speed
  54.     BlockScroll 0,i,w,1,0,j,0
  55.   Next
  56.   VWait;  equalize the speed.
  57. Next
  58. Cls 0
  59.  
  60. ;Flood from top To bottom
  61.  
  62. Use BitMap 1
  63. ; loop from 0 to bitmap height -1 (for each line)
  64. For i=h-1 To 0 Step -1
  65.   ; draw the current line from top to i
  66.   For j=0 To i
  67.     ; using blockscroll for speed
  68.     BlockScroll 0,i,w,1,0,j,0
  69.   Next
  70.   VWait;  equalize the speed.
  71. Next
  72.  
  73. ;Flood from top&bottom to the middle
  74.  
  75. Use BitMap 1
  76. ; loop from 0 to bitmap height / 2 (for half the number of lines)
  77. For i=0 To h/2
  78.   ; draw the current line from bottom to i
  79.   ti=h/2+i; There's no reason to calculate this every cycle, is there?
  80.   For j=h-1 To ti+1 Step -1
  81.     ; using blockscroll for speed
  82.     BlockScroll 0,ti,w,1,0,j,0
  83.   Next
  84.   ; draw the current line from top to h/2-i
  85.   ti=h/2-i; There's no reason to calculate this every cycle, is there?
  86.   For j=0 To ti
  87.     ; using blockscroll for speed
  88.     BlockScroll 0,ti,w,1,0,j,0
  89.   Next
  90. Next
  91.  
  92. MouseWait;  wait, so you can see the result:)
  93. End
  94. ;# Code End